home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 4 / Amiga Tools 4.iso / tools / internet-tools / connect-line / cl / rexx / cl-newboards.clrexx < prev    next >
Encoding:
Text File  |  1996-02-05  |  5.8 KB  |  213 lines

  1. /*
  2. **  $VER: CL-NewBoards.clrexx 1.1 (05 Feb 1996)  **
  3. **
  4. **        © 1995-96 Ralf Ramge
  5. **
  6. **  PROGRAMNAME:
  7. **      CL-NewBoards.clrexx
  8. **
  9. **  FUNCTION:
  10. **
  11. **      Demonstrationsskript zur cl_rexx.library, Connectline 5.0
  12. **
  13. **      Connectline © 1986-1995 Oliver Wagner, Mathias Mischler
  14. **      cl_rexx.library © 1995 Mathias Mischler
  15. **
  16. **      Scannt die Brettliste und sucht nach neuen, automatisch
  17. **      eingetragenen Brettern. Diese Liste wird dann verschickt.
  18. **
  19. **      Aufruf: rx CL-NewBoards.clrexx [param]
  20. **
  21. **      param - Irgendwas ... wird dem Skript was übergeben, so
  22. **              kommt nach Abschluß der Arbeit kein Prompt (für
  23. **              Start via Cron)
  24. **
  25. **      Konfiguration ähnlich Newfiles:
  26. **
  27. **      CONNECTLINE:Rexx/Data/CL-NewBoards.betreff beinhaltet ei-
  28. **      ne einzige Zeile, nämlich den Betreff der zu versendenden
  29. **      Mail. Wird diese Datei nicht gefunden, verwurschtelt das
  30. **      Skript einen Defaultwert.
  31. **      CONNECTLINE:Rexx/Data/CL-NewBoards.user beinhaltet eine
  32. **      Liste der Empfänger. Pro Zeile einer.
  33. **      CONNECTLINE:Rexx/Data/CL-NewBoards.header beinhaltet den
  34. **      Kopf, der der Liste vorangestellt wird.
  35. **      CONNECTLINE:Rexx/Data/CL-NewBoards.trailer dementsprech-
  36. **      end den Rattenschwanz, der in der Mail unter die Liste
  37. **      geklatscht wird.
  38. **      CONNECTLINE:Rexx/Data/CL-NewBoards.date wird vom Skript
  39. **      generiert und beinhaltet das jeweilige Bezugsdatum. Flos-
  40. **      sen weg! ;)
  41. **
  42. **  $HISTORY:
  43. **
  44. **   30 Dec 1995 : 1.0 : initial release
  45. **   31 Dec 1995 : 1.01: Wie üblich falscher Text im Fensterrahmen
  46. **   13 Jan 1996 : 1.02: Erster Empfänger wurde verschluckt
  47. **                       Dummy-Space nach Ausgabe eingefügt
  48. **   16 Jan 1996 : 1.03: Dämlichkeitsfehler beim Öffnen der rexxlib
  49. **   05 Feb 1996 : 1.1 : kosmetische Fixes
  50. */
  51.  
  52. param=arg(1)
  53. iomod='CONNECTLINE:Rexx/Modules/stdio.clrexxmod'
  54.  
  55. /* rexxsupport.library öffnen */
  56.  
  57. if ~show('L','rexxsupport.library') then do
  58.     if ~addlib('rexxsupport.library',0,-30,0) then exit 10
  59.     end
  60.  
  61. /* cl_rexx.library öffnen */
  62.  
  63. if ~show('L','cl_rexx.library') then do
  64.     if ~addlib('cl_rexx.library',0,-30,0) then exit 10
  65.     end
  66.  
  67. /* Fontsize ermitteln */
  68.  
  69. gfxbase=showlist(l,'graphics.library',0,a)
  70. call forbid
  71. FontAddress=next(gfxbase,154)
  72. Fontsize=c2d(IMPORT(offset(FontAddress,20),2))
  73. call permit
  74. windowwidth=Fontsize*50
  75. windowheight=Fontsize*15
  76. windowY=Fontsize+1
  77. WindowX=Fontsize
  78.  
  79. /* Standard-IO umleiten */
  80.  
  81. screen=CLGET_FrontScreenName()
  82. call close STDOUT
  83. if ~open(STDOUT,'CON:'windowX'/'windowY'/'windowwidth'/'windowheight'/CL-NewBoards/SCREEN'screen,'W') then
  84.     exit 20
  85. else do
  86.     call close STDIN
  87.     call open STDIN,'*',R
  88.     call pragma '*'
  89.     end
  90.  
  91. /* Bezugsdatum einlesen */
  92.  
  93. address command
  94.  
  95. 'rx 'iomod' CURSOROFF'
  96.  
  97. if open('bd','CONNECTLINE:Rexx/Data/CL-NewBoards.date','R') then do
  98.     bezdate=readln('bd')
  99.     call close 'bd'
  100.     end
  101. else bezdate='00000000000000'
  102.  
  103. say 'Bezugsdatum: 'substr(bezdate,7,2)'.'substr(bezdate,5,2)'.'left(bezdate,4)' 'substr(bezdate,9,2)':'substr(bezdate,11,2)':'substr(bezdate,13,2)
  104.  
  105.  
  106. /* Empfänger einlesen */
  107.  
  108. if exists('CONNECTLINE:Rexx/Data/CL-NewBoards.user') then
  109.      empanz=CL_GetText('CONNECTLINE:Rexx/Data/CL-NewBoards.user',emp)
  110. else empanz=0
  111. say 'Insgesamt wird an 'empanz' Empfänger verschickt.'
  112. say ''
  113.  
  114. /* Betreff einlesen */
  115.  
  116. betreff='Neue Bretter in der '||upper(CLGET_OwnSystemName())
  117.  
  118. if open('bet','CONNECTLINE:Rexx/Data/CL-NewBoards.betreff','R') then do
  119.     betreff=readln('bet')
  120.     call close 'bet'
  121.     end
  122.  
  123.  
  124. /* Brettliste einlesen */
  125. say 'Lese Brettliste ...'
  126. banz=CLGET_BoardList(brett)-1
  127. if banz=-1 then exit
  128.  
  129. /* Suche nach autoeingetragenen Brettern mit LastWrite > Bezugsdatum */
  130.  
  131. x=0
  132. say 'Durchsuche Brettliste ...'
  133. call writech STDOUT,' '
  134. do i=0 to banz
  135.     if i//5=0 then do
  136.         select
  137.             when i//4=1 then call writech(STDOUT,'-')
  138.             when i//4=2 then call writech(STDOUT,'\')
  139.             when i//4=3 then call writech(STDOUT,'|')
  140.             otherwise call writech(STDOUT,'/')
  141.             end
  142.         end
  143.     test=CLIS_BoardAutoEntry(brett.i)
  144.     if test='1' then do
  145.         tempdate=translate(CLGET_BoardLastWrite(brett.i),'  ','.:')
  146.         lastdatum=word(tempdate,3)||word(tempdate,2)||word(tempdate,1)
  147.         lastdatum=lastdatum||word(tempdate,4)||word(tempdate,5)||word(tempdate,6)
  148.         if lastdatum~<bezdate then do
  149.             x=x+1
  150.             new.x='/'brett.i
  151.             say 'Gefunden: 'new.x
  152.             call writech STDOUT,' '
  153.             end
  154.         end
  155.     end
  156. call writech STDOUT,'08'x
  157. datum=date(S)||compress(time(),':')
  158.  
  159. /* Brettliste erstellen und versenden */
  160.  
  161. say x' neue Bretter gefunden!'
  162.  
  163. if x>0 then do
  164.     address command 'copy >NIL: CONNECTLINE:Rexx/Data/CL-NewBoards.header T:Brettliste'
  165.  
  166.     if ~open('out','T:Brettliste','A') then do
  167.         if ~open('out','T:Brettliste','W') then do
  168.             say 'Konnte Tempdatei nicht öffnen!'
  169.             call ende
  170.             end
  171.         end
  172.  
  173.     call writeln 'out',''
  174.  
  175.     do i=1 to x
  176.         call writeln('out',new.i)
  177.         end
  178.  
  179.     if exists('CONNECTLINE:Rexx/Data/CL-NewBoards.trailer') then do
  180.         zeilenanz=CL_GetText('CONNECTLINE:Rexx/Data/CL-NewBoards.trailer',zeile)
  181.         if zeile>0 then do
  182.             call writeln 'out',''
  183.             do x=0 to zeilenanz-1
  184.                 call writeln 'out',zeile.x
  185.                 end
  186.             end
  187.         end
  188.  
  189.     call close 'out'
  190.  
  191.     if ~open('out','CONNECTLINE:Rexx/Data/CL-NewBoards.date','W') then call ende
  192.  
  193.     do x=0 to empanz-1
  194.         call CL_SendMailFull('Newboards',emp.x,'T:Brettliste','','','Neue Bretter in der 'upper(CLGET_OwnSystemName()),'TEXT','Z')
  195.         end
  196.  
  197.     call writeln 'out',datum
  198.     call close 'out'
  199.  
  200.     address command 'delete >NIL: T:Brettliste'
  201.     end
  202.  
  203. ende:
  204.  
  205. if param='' then do
  206.     options prompt 'Bitte drücken Sie <RETURN>'
  207.     pull dummy
  208.     end
  209. 'rx 'iomod' CURSORON'
  210. call close STDIN
  211. call close STDOUT
  212. exit
  213.